import request from '@/utils/request'

const squareCategoryApi = {
    /**
     * 所有广场分类
     */
    whole(params: any): Promise<any> {
        return request.get({
            url: '/square/category/whole',
            params
        })
    },

    /**
     * 广场分类列表
     */
    lists(params: {
        page_no?: number;
        page_size?: number;
        type?: string;
        name?: string;
        is_disable: number;
    }): Promise<any> {
        return request.get({
            url: '/square/category/lists',
            params
        })
    },

    /**
     * 广场分类详情
     */
    detail(id: number): Promise<any> {
        return request.get({
            url: '/square/category/detail',
            params: {
                id
            }
        })
    },

    /**
     * 广场分类新增
     */
    add(params: {
        scene: string;
        name: string;
        sort?: number;
        is_disable?: number;
    }): Promise<any> {
        return request.post({
            url: '/square/category/add',
            params
        })
    },

    /**
     * 广场分类编辑
     */
    edit(params: {
        id: number;
        scene: string;
        name: string;
        sort?: number;
        is_disable?: number;
    }): Promise<any> {
        return request.post({
            url: '/square/category/edit',
            params
        })
    },

    /**
     * 广场分类删除
     */
    delete(id: number): Promise<any> {
        return request.post({
            url: '/square/category/delete',
            params: {
                id
            }
        })
    }
}

export default squareCategoryApi
